#version 430 core

struct ModelData
{
    vec4 position;
    vec4 texCoord;
    vec4 normal;
};

layout (std430, binding=0)buffer Mesh{
    ModelData vertexes[];
}mesh;

uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;

out vec3 vs_normal;
out vec3 vs_objPos;
out vec4 vs_worldPos;
out vec2 vs_texcoord;

//out vec3 tcs_vs_normal;
//out vec3 tcs_vs_objPos;
//out vec4 tcs_vs_worldPos;
//out vec2 tcs_vs_texcoord;

void main()
{
    
	vs_normal = mesh.vertexes[gl_VertexID].normal.xyz; // mat3(norma)
    vs_objPos = mesh.vertexes[gl_VertexID].position.xyz;
	vs_worldPos = model * vec4(mesh.vertexes[gl_VertexID].position.xyz,1.0);
	vs_texcoord = mesh.vertexes[gl_VertexID].texCoord.xy;
    vec3 k = -cross(vs_normal, vec3(0,0,1));
    float cos_theta = dot(normalize(vs_normal), vec3(0,0,1));
    float sin_theta = sin(acos(cos_theta));
    gl_Position = projection * view * vs_worldPos;

	//tcs_vs_normal = mesh.vertexes[gl_VertexID].normal.xyz; // mat3(norma)
    //tcs_vs_objPos = mesh.vertexes[gl_VertexID].position.xyz;
	//tcs_vs_worldPos = model * vec4(mesh.vertexes[gl_VertexID].position.xyz,1.0);
	//tcs_vs_texcoord = mesh.vertexes[gl_VertexID].texCoord.xy;
    //vec3 k = -cross(tcs_vs_normal, vec3(0,0,1));
    //float cos_theta = dot(normalize(tcs_vs_normal), vec3(0,0,1));
    //float sin_theta = sin(acos(cos_theta));
    //gl_Position = projection * view * tcs_vs_worldPos;
}